﻿Imports Microsoft.VisualBasic
Imports System.Xml.Serialization

<XmlRoot("CONSOLIDATED_LIST")>
Public Class RawUNXMLEntity
    Implements ISanctionListType

    <XmlAttributeAttribute("dateGenerated")>
    Public unDateGenerate As String
    <XmlElement("INDIVIDUALS")>
    Public individualsInstance As New Individual
    <XmlElement("ENTITIES")>
    Public entitiesInstance As New Entities

    Public Class Individual
        Private mIndividualList As List(Of IndividualDetail)
        <XmlElement("INDIVIDUAL")>
        Public Property IndividualListProperty() As List(Of IndividualDetail)
            Get
                Return mIndividualList
            End Get
            Set(ByVal value As List(Of IndividualDetail))
                mIndividualList = value
            End Set
        End Property



        Public Class IndividualDetail
            <XmlElement("DATAID")>
            Public data_id As Integer
            <XmlElement("VERSIONNUM")>
            Public version_number As Integer
            <XmlElement("FIRST_NAME")>
            Public first_name As String
            <XmlElement("SECOND_NAME")>
            Public second_name As String
            <XmlElement("THIRD_NAME")>
            Public third_name As String
            <XmlElement("FOURTH_NAME")>
            Public fourth_name As String
            <XmlElement("UN_LIST_TYPE")>
            Public UN_LIST_TYPE As String
            <XmlElement("REFERENCE_NUMBER")>
            Public refference_number As String
            <XmlElement("LISTED_ON")>
            Public listOn As String
            <XmlElement("SUBMITTED_BY")>
            Public submitted_by As String
            <XmlElement("GENDER")>
            Public gender As String
            <XmlElement("NAME_ORIGINAL_SCRIPT")>
            Public originalScript As String
            <XmlElement("COMMENTS1")>
            Public comments1 As String
            <XmlElement("NATIONALITY2")>
            Public nationality2 As String = ""
            <XmlElement("SORT_KEY")>
            Public sort_key As String
            <XmlElement("SORT_KEY_LAST_MOD")>
            Public sort_key_last_modidy As String
            <XmlElement("TITLE")>
            Public title_name As BaseElemetValueString
            <XmlElement("NATIONALITY")>
            Public nationality1 As New BaseElemetValueString
            <XmlElement("LAST_DAY_UPDATED")>
            Public lastdayUpdated As BaseElemetValueString
            <XmlElement("LIST_TYPE")>
            Public listType As BaseElemetValueString
            <XmlElement("INDIVIDUAL_ALIAS")>
            Public aliasList As List(Of AliasInfo)
            <XmlElement("INDIVIDUAL_ADDRESS")>
            Public addressList As List(Of AddressInfo)
            <XmlElement("INDIVIDUAL_DATE_OF_BIRTH")>
            Public dobList As List(Of BirthInfo)
            <XmlElement("INDIVIDUAL_PLACE_OF_BIRTH")>
            Public pobList As List(Of AddressInfo)
            <XmlElement("INDIVIDUAL_DOCUMENT")>
            Public docList As List(Of DocumentInfo)

            Private entityType As String
            Public ReadOnly Property EntityTypeProperty() As String
                Get
                    Return "Person"
                End Get

            End Property
        End Class

    End Class

    Public Class Entities

        Private mEntities As List(Of EntityDetail)
        <XmlElement("ENTITY")>
        Public Property EntitieDetails() As List(Of EntityDetail)
            Get
                Return mEntities
            End Get
            Set(ByVal value As List(Of EntityDetail))
                mEntities = value
            End Set
        End Property


        Public Class EntityDetail
            <XmlElement("DATAID")>
            Public data_id As Integer
            <XmlElement("VERSIONNUM")>
            Public version_number As Integer
            <XmlElement("LIST_TYPE")>
            Public list_type As BaseElemetValueString
            <XmlElement("LAST_DAY_UPDATED")>
            Public last_update As BaseElemetValueString
            'FIRST_NAME
            <XmlElement("FIRST_NAME")>
            Public first_name As String = ""
            'UN_LIST_TYPE
            <XmlElement("UN_LIST_TYPE")>
            Public UNListType As String
            'REFERENCE_NUMBER
            <XmlElement("REFERENCE_NUMBER")>
            Public refNumber As String
            'LISTED_ON
            <XmlElement("LISTED_ON")>
            Public listON As String
            'SUBMITTED_ON
            <XmlElement("SUBMITTED_ON")>
            Public submitON As String
            'NAME_ORIGINAL_SCRIPT
            <XmlElement("NAME_ORIGINAL_SCRIPT")>
            Public nameOriginalScript As String
            'COMMENTS1
            <XmlElement("COMMENTS1")>
            Public comments1 As String
            'SORT_KEY
            <XmlElement("SORT_KEY")>
            Public sortkey As String
            'SORT_KEY_LAST_MOD
            <XmlElement("SORT_KEY_LAST_MOD")>
            Public sortkeylastmod As String

            <XmlElement("ENTITY_ALIAS")>
            Public aliasList As List(Of AliasInfo)
            <XmlElement("ENTITY_ADDRESS")>
            Public addressList As List(Of AddressInfo)

            Private entityType As String
            Public ReadOnly Property EntityTypeProperty() As String
                Get
                    Return "Entity"
                End Get

            End Property

        End Class
    End Class

    Public Class BaseElemetValueString
        <XmlElement("VALUE")>
        Public values As New List(Of String)
    End Class

    Public Class AliasInfo
        <XmlElement("QUALITY")>
        Public quality As String
        <XmlElement("ALIAS_NAME")>
        Public alias_name As String
        <XmlElement("DATE_OF_BIRTH")>
        Public dob As String
        <XmlElement("CITY_OF_BIRTH")>
        Public cityOfBirth As String
        <XmlElement("COUNTRY_OF_BIRTH")>
        Public countryOFBirth As String
        <XmlElement("NOTE")>
        Public note As String
    End Class
    Public Class AddressInfo
        'STREET
        <XmlElement("STREET")>
        Public street As String = ""
        'CITY
        <XmlElement("CITY")>
        Public city As String = ""
        'ZIP_CODE
        <XmlElement("ZIP_CODE")>
        Public zipcode As String = ""
        'STATE_PROVINCE
        <XmlElement("STATE_PROVINCE")>
        Public state As String = ""
        'COUNTRY
        <XmlElement("COUNTRY")>
        Public country As String = ""
        'NOTE
        <XmlElement("NOTE")>
        Public note As String = ""
    End Class

    Public Class BirthInfo
        ' TYPE_OF_DATE
        <XmlElement("TYPE_OF_DATE")>
        Public dateType As String
        ' DATE
        <XmlElement("DATE")>
        Public birthDate As String
        ' FROM_YEAR
        <XmlElement("FROM_YEAR")>
        Public fromYear As String
        ' TO_YEAR
        <XmlElement("TO_YEAR")>
        Public toYear As String
        ' NOTE
        <XmlElement("NOTE")>
        Public note As String = ""
        ' YEAR
        <XmlElement("YEAR")>
        Public year As String

    End Class

    Public Class DocumentInfo
        ' TYPE_OF_DOCUMENT
        <XmlElement("TYPE_OF_DOCUMENT")>
        Public docType1 As String = ""
        ' TYPE_OF_DOCUMENT2
        <XmlElement("TYPE_OF_DOCUMENT2")>
        Public docType2 As String = ""
        ' NUMBER
        <XmlElement("NUMBER")>
        Public docNumber As String = ""
        ' ISSUING_COUNTRY (Like a Nationality)
        <XmlElement("ISSUING_COUNTRY")>
        Public issueCountry As String = ""
        ' DATE_OF_ISSUE
        <XmlElement("DATE_OF_ISSUE")>
        Public issueDate As String
        ' CITY_OF_ISSUE
        <XmlElement("CITY_OF_ISSUE")>
        Public issueCity As String
        ' COUNTRY_OF_ISSUE
        <XmlElement("COUNTRY_OF_ISSUE")>
        Public countryIssue As String = ""
        ' NOTE
        <XmlElement("NOTE")>
        Public note As String
    End Class

    Public Function GetTypes() As sanctionListType Implements ISanctionListType.GetTypes
        Return sanctionListType.UN
    End Function

End Class
